package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.SellBean;
import com.project.service.ISellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * @Title: SellController
 * @Package: com.project.controller
 * @Description:
 * @Author: Liang-Xie
 */
@SuppressWarnings("all")
@RestController
@RequestMapping("sell")
public class SellController {
    @Autowired
    private ISellService sellService;

    @RequestMapping("add")
    public String add(SellBean sell, Integer userId) {
        sellService.add(sell, userId);
        return "ok";
    }

    @RequestMapping("findByItem")
    public IPage<SellBean> findByItem(Integer pageNO, String name, LocalDate startDate, LocalDate endDate) {
        return sellService.findByItem(pageNO, name, startDate, endDate);
    }

    @RequestMapping("findById")
    public SellBean findById(Integer sellId) {
        return sellService.findById(sellId);
    }
}
